const constraints = {
    'video' : true,
    'audio' : true
}
console.log("加载成功");

function onOpen(e){
navigator.mediaDevices.getUserMedia(constraints)
.then(stream => {
    const video = document.querySelector("#local-video");
    video.srcObject = stream ;
    const audio = document.querySelector("#local-audio");
    audio.srcObject = stream;
    console.log('Got video:', stream);
})
.catch(error => {
    console.error('Error accessing media devices.', error);
});
}
document.querySelector("#open").addEventListener("click",onOpen);